import React,{ useReducer }  from 'react'
import { HashRouter } from 'react-router-dom'
import { renderRoutes } from 'react-router-config'
import Store from "@/reducer/store/index"
import { reducer, initialState } from '@/reducer/index';
import Loading from '@/components/Loading'

import routes from '@/routes.js'
import './App.scss'

const App = () => {
  const [state, dispatch] = useReducer(reducer, initialState);
  return (
    <Store.Provider value={{ state, dispatch }}>
      <div className="App">
        <HashRouter>{renderRoutes(routes)}</HashRouter>
      </div>
      <Loading></Loading>
    </Store.Provider>
  )
}

export default App
